Latest Posts block: use align supports flag + add left/right align support #10707
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #8777.
(Note that this PR currently contains #10706, which is a blocker for this one due to both modifying the same file. Once that PR is merged, this one will be rebased.)
This PR refactors the Latest Posts block to use the
supports: { align }
flag and adds support for theleft
andright
alignments to the block. Notably, support for those alignments was already implied bygetEditWrapperProps
inindex.js
, but due to mistakes inmaster
, the alignments could not be chosen in the editor. This PR also adds anenum
property to thealign
attribute inindex.php
to prevent invalid alignment classes from appearing on the front-end.This PR is pretty much the same as #10706, except it is for the Latest Posts block rather than the Archives block.
Types of changes
supports: { align }
to add block alignment support to the block.enum
to thealign
attribute defined inindex.php
to fix an issue inmaster
where you could set invalid values for the attribute, which would result in invalid classes (e.g. "alignbob") on the front-end.index.php
and made it consistent with other blocks (e.g. Archives and Categories blocks).index.php
were in a random order; now they are in alphabetical order.Related PRs